//
//  GuideCell.swift
//  CompareBuying
//
//  Created by 唐先才 on 16/2/24.
//  Copyright © 2016年 唐先才. All rights reserved.
//

import UIKit

class GuideCell: UICollectionViewCell {

    @IBOutlet weak var guidePic: UIImageView!
    
    @IBOutlet weak var nextBtn: UIButton!
    private let nextButton = UIButton(frame: CGRectMake((WIDTH - 100) * 0.5, HEIGHT - 110, 100, 33))
    
//    override init(frame: CGRect) {
//        super.init(frame: frame)
//        nextButton.setBackgroundImage(UIImage(named: "guideNext"), forState: UIControlState.Normal)
//        nextButton.addTarget(self, action: "nextButtonClick", forControlEvents: .TouchUpInside)
//        //        nextButton.hidden = true
//        print("加上按钮")
//        guidePic.addSubview(nextButton)
//    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        nextBtn.setBackgroundImage(UIImage(named: "guideNext"), forState: UIControlState.Normal)
        nextBtn.addTarget(self, action: "nextBtnClick", forControlEvents: .TouchUpInside)
        nextBtn.hidden = true
        contentView.addSubview(nextBtn)
    }
    
    func setNextBtnHidden(hidden: Bool) {
        nextBtn.hidden = hidden
    }
    
    func nextBtnClick() {
        NSNotificationCenter.defaultCenter().postNotificationName("GuideViewControllerDidFinish", object: nil)
    }
}
